//
//  RealCustomerCell.m
//  WGFGlobalHouses
//
//  Created by waiguofang on 15/5/22.
//  Copyright (c) 2015年 waiguofang. All rights reserved.
//

#import "RealCustomerCell.h"

@implementation RealCustomerCell

-(void)cellWithTableView:(UITableView *)tableView;
{
    self.delegate = tableView;
    
    self.showFuntionBtn1 = true;
    self.showFuntionBtn2 = true;
    self.showFuntionBtn3 = true;
    [self setContentHight:60];
    
    
    self.customerView= [CustomerView  createView];
    
    [self.customerView setFrame:CGRectMake(0, 0, self.contentMoveView.frame.size.width, self.contentMoveView.frame.size.height)];
    
     [self.customerView setUserInteractionEnabled:false];
    
    [self.funtionBtn3 addTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside];
    [self.funtionBtn2 addTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside];
    [self.funtionBtn1 addTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside];
    
    [self.contentMoveView addSubview:self.customerView];
}
-(void)setModel:(CustomerModel *)model
{
    _model = model;
    [self reSetBtnNameWithStauts:model.consumerState];
    self.customerView.model = model;
}
+(CGFloat)getHeight;
{
    return 60;
}

-(void)btnClicked:(UIButton*)btn
{
    switch (btn.tag) {
        case 101://编辑
            
            if (self.btnDelegate && [self.btnDelegate respondsToSelector:@selector(realCustomerCellDidClickEditBtnWithCustomerModel:)]) {
                [self.btnDelegate realCustomerCellDidClickEditBtnWithCustomerModel:self.model];
            }

            break;
        case 102://禁用
            if (self.btnDelegate && [self.btnDelegate respondsToSelector:@selector(realCustomerCellDidClickForbiddenBtnWithCustomerId: withStauts:)]) {
                [self.btnDelegate realCustomerCellDidClickForbiddenBtnWithCustomerId:self.model.consumerId withStauts:self.model.consumerState];
            }

    
            break;
        case 103://绑定楼盘
        {
            if (self.btnDelegate && [self.btnDelegate respondsToSelector:@selector(realCustomerCellDidClickBingPremisesWithCustomerId: withConsumerCode:)]) {
                [self.btnDelegate realCustomerCellDidClickBingPremisesWithCustomerId:self.model.consumerId withConsumerCode:self.model.consumerCode];
            }
        }
            break;
            
        default:
            break;
    }
}


-(void)setIsEditMode:(Boolean)isEditMode{
    
    
    [self cloadMenu];
    
    [self setScrollAble:!isEditMode];
    
    [self.customerView setIsEditMode:isEditMode];
}


@end
